<template>
	<view>

	<view class="u-content">
		<view>{{info.name}}</view>
		
		<u-parse :content="info.content" :selectable="true"></u-parse>
		<view  v-for="(img, index) in info.imgs" :key="index" v-if="info.imgs.length>0">
			<image :src="img.file_url" :lazy-load="true" mode="widthFix" style="margin: auto;"></image>
		</view>
	</view>
	
	</view>
</template>

<script>

export default {

	data() {
		return {
			info:[]
		};
	},
  onLoad(options) {
	let query = JSON.parse(decodeURIComponent(options.query));

	   //uni.setNavigationBarTitle({title});
	   let content_id=query.id;
       this.articleview(content_id);
	},

	methods: {
		articleview(content_id){
                return new Promise((resolve, reject) => {
                    this.$api('archives.article_view', {
						content_id:content_id
					}).then(res => {
						if (res.code==200){
							this.info=res.data
							console.log(this.info)
						}
                    }).catch((e)=>{
                        resolve(false);
                    });
                })
		},
	},
};
</script>

<style lang="scss" scoped>
    .u-content{
		padding: 30rpx;
		color: $u-content-color;
		font-size: 32rpx;
		line-height: 1.8;
		
		// 标签形式无效
		p {
			color: $u-tips-color;
		}
	}
</style>
